<template>
  <div class="carouse-box">
    <el-carousel class="carouselDom" v-bind="carouselProps">
      <el-carousel-item>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '1-1',
                title: '涉案专利附图',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '1-1' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">涉案专利附图</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '1-2',
                title: '对比文件1',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '1-2' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件1</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '1-3',
                title: '对比文件2',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '1-3' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件2</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '1-4',
                title: '对比文件3',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '1-4' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件3</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '1-5',
                title: '对比文件4',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '1-5' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件4</p>
        </div>
      </el-carousel-item>
      <el-carousel-item>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '2-1',
                title: '涉案专利附图',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '2-1' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">涉案专利附图</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '2-2',
                title: '对比文件1',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '2-2' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件1</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '2-3',
                title: '对比文件2',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '2-3' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件2</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '2-4',
                title: '对比文件3',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '2-4' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件3</p>
        </div>
        <div class="container-img">
          <img
            @click="
              haveModel({
                currentIndex: '2-5',
                title: '对比文件4',
              })
            "
            src="@/assets/image/pic.jpeg"
            :class="currentIndex === '2-5' ? 'is-active' : ''"
            alt=""
          />
          <p class="itemTitle">对比文件4</p>
        </div>
      </el-carousel-item>
    </el-carousel>
    <div class="model-img">
      <img src="@/assets/image/pic.jpeg" alt="" />
      <p>{{ modelImgSrcObj.title }}</p>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      currentIndex: "1-1",
      modelImgSrcObj: {
        url: "@/assets/image/pic.jpeg",
        title: "涉案专利附图",
      },
      carouselProps: {
        arrow: "always",
        height: "170px",
        autoplay: false,
        loop: true,
        indicatorPosition: "none",
      },
      imgList: [
        {
          url: "@/assets/image/pic.jpeg",
        },
        {
          url: "@/assets/image/pic.jpeg",
        },
        {
          url: "@/assets/image/pic.jpeg",
        },
        {
          url: "@/assets/image/pic.jpeg",
        },
        {
          url: "@/assets/image/pic.jpeg",
        },
      ],
    };
  },
  methods: {
    haveModel({ currentIndex, title }) {
      this.currentIndex = currentIndex;
      this.modelImgSrcObj.title = title;
    },
  },
};
</script>
<style lang="scss" scoped>
$font-color: #303113;
$main-color: #303133;
$blue-color: #2d54b8;
.carouselDom {
  padding: 0 20px;
  box-sizing: border-box;
  border-bottom: 1px solid #f0f0f0;
  //   ::v-deep.el-carousel__item {
  //     width: 25%;
  //   }
  ::v-deep.el-carousel__container {
    .el-carousel__arrow {
      transform: translateY(-100%);
    }
    .el-carousel__arrow--right {
      right: -27px;
      background-color: transparent;
      color: #000;
      font-size: 24px;
      font-weight: 900 !important;
      .el-icon-arrow-right {
        &::before {
          font-weight: 900;
        }
      }
    }
    .el-carousel__arrow--left {
      left: -27px;
      background-color: transparent;
      color: #000;
      font-size: 24px;
      .el-icon-arrow-left {
        &::before {
          font-weight: 900;
        }
      }
    }
  }
  .el-carousel__item {
    display: flex;
    justify-content: space-around;
    .container-img {
      width: 18%;
      .itemTitle {
        margin-bottom: 0;
        margin-top: 10px;
        color: $font-color;
        font-size: 14px;
        text-align: center;
      }
      img {
        vertical-align: bottom;
        height: 117px;
        width: 100%;
        box-sizing: border-box;
        border: 1px solid #ddd;
        cursor: pointer;
        &.is-active {
          border: 2px solid $blue-color;
        }
        &:hover,
        &:focus {
          border: 2px solid $blue-color;
        }
      }
    }
  }
}
.model-img {
  margin: 20px 0;
  img {
    height: 355px;
    width: 420px;
    border: 1px solid #d8d8d8;
    box-sizing: border-box;
  }
  p {
    text-align: center;
    margin: 0;
    color: $font-color;
    font-size: 14px;
    width: 420px;
    margin-top: 10px;
  }
}
</style>

